

#include "wxsMathPlot.h"


namespace
{

    #include "images/plot16.xpm"
    #include "images/plot32.xpm"

    wxsRegisterItem<wxsMathPlot> Reg(
        _T("mpWindow"),                
        wxsTContainer,                 
        _T("wxWindows"),               
        _T("Ron Collins"),             
        _T("rcoll@theriver.com"),      
        _T(""),                        
        _T("MathPlot"),                
        90,                            
        _T("MathPlot"),                
        wxsCPP,                        
        1, 0,                          
        wxBitmap(plot32_xpm),          
        wxBitmap(plot16_xpm),          
        false);                        


    WXS_ST_BEGIN(wxsMathPlotStyles,_T("wxRAISED_BORDER|wxTAB_TRAVERSAL"))
        WXS_ST_CATEGORY("wxMathPlot")
        WXS_ST_DEFAULTS()
    WXS_ST_END()

    WXS_EV_BEGIN(wxsMathPlotEvents)
        WXS_EV_DEFAULTS()
    WXS_EV_END()
}


wxsMathPlot::wxsMathPlot(wxsItemResData* Data):
    wxsContainer(
        Data,
        &Reg.Info,
        wxsMathPlotEvents,
        wxsMathPlotStyles) {


    mXScale = 1.0;
    mYScale = 1.0;

}



void wxsMathPlot::OnBuildCreatingCode() {
wxString    inc;
wxString    vname;
wxString    aname;
wxString    cname;


    if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsMathPlot::OnBuildCreatingCode"),GetLanguage());


    vname = GetVarName();


    AddHeader(_("<mathplot.h>"), GetInfo().ClassName, 0);


    Codef(_T("%s = new mpWindow(%W, %I, %P, %S, %T);\n"), vname.wx_str());
    BuildSetupWindowCode();


    AddChildrenCode();


    Codef(_T("%AUpdateAll();\n"));
    Codef(_T("%AFit();\n"));
}


wxObject* wxsMathPlot::OnBuildPreview(wxWindow* Parent, long Flags) {
mpWindow        *mp;


    mp = new mpWindow(Parent, GetId(), Pos(Parent), Size(Parent), Style());
    if (mp == NULL) return NULL;
    SetupWindow(mp, Flags);


    AddChildrenPreview(mp, Flags);


    mp->UpdateAll();
    mp->Fit();


    return mp;
}


void wxsMathPlot::OnEnumContainerProperties(cb_unused long Flags) {
};


bool wxsMathPlot::OnCanAddChild(cb_unused wxsItem* Item, cb_unused bool ShowMessage) {



    return true;
}
